/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Server.lastproject;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JTable;

/**
 *
 * @author CANG
 */
public class TableData_StructClickLisstener extends MouseAdapter
{
    private JTable _jtDataStruct = null;
    private ServerForm _server;
    private MyPopMenu_TableStruct menu;    
    
    public TableData_StructClickLisstener(JTable table, ServerForm server,String NameTable)
    {
        menu = new MyPopMenu_TableStruct(server, table,NameTable);
        _server = server;
        //_jtDataStruct = table;
    }
    
    public void mouseReleased(MouseEvent e)
    {
        if(e.isPopupTrigger())
        {
            if(_jtDataStruct == null)
                _jtDataStruct = (JTable)e.getSource();
            showPop(e);
        }
    }
    
    private void showPop(MouseEvent e)
    {        
        menu.show(e.getComponent(), e.getX(), e.getY());
    }
    
    public void setTableOwner(String nameTable)
    {
        menu.setDataTableOwner(nameTable);
    }
    
    public void setCreateTable()
    {
        menu.setCreateTable();
    }
    
    public void setUdateTable()
    {
        menu.setUpdateTable();
    }
}
